import SockJS from 'sockjs-client';
import {Stomp} from 'stompjs';

const socket = new SockJS('http://localhost:8083/ws');
const stompClient = Stomp.Stomp.over(socket);

export function connect(callback) {
  stompClient.connect({}, frame => {
    console.log('Connected:'+frame);
    callback(stompClient);
  })
}

export function disconnect() {
  if(stompClient.connected) {
    stompClient.disconnect();
  }
}
